import axiosInstance from '@/request/axios-config'

// 查询用户菜单
export const searchSelfMenusService = () => {
    return axiosInstance.get("/menu/getSelfMenu")
}

// 获取列表数
export const listTreeService = (data: any) => {
     return axiosInstance.post('/menu/listTree', data)
}

// 新增菜单
export const addMenuService = (data: any) => {
   return axiosInstance.post('/menu/add', data)
}

// 删除菜单
export const deleteMenuService = (menuId: any) => {
    return axiosInstance.delete('/menu/delete/'+ menuId)
}

// 修改菜单
export const updateMenuService = (data: any) => {
    return axiosInstance.put('/menu/edit', data)
}

// 根据id查menu
export const getMenuById = (id: any) => {
    return axiosInstance.get('/menu/getMenuById', {
        params: {id: id}
    })
}
// 查询菜单列表
export const listMenu = (query: any) => {
    return axiosInstance.get('/menu/list', { params: query })
}

// 查询菜单下拉树结构
export const menuTreeselect = () => {
    return axiosInstance.get('/menu/treeselect')
}

// 根据角色ID查询菜单下拉树结构
export const roleMenuTreeselect = async (roleId: any) => {
    return axiosInstance.get(`/menu/roleMenuTreeselect/${roleId}`)
}
